public class Main1351 {
    public static void main(String[] args) {
        int a=40;
        int b=8;
        int c=3;
        for(int i=1;i<=(a-c)/b;i++){
            for (int j=(a-b)/c;j>=1;j--){
                if (b*i+c*j==a){
                    System.out.println(i+" "+j);
                }
            }
        }
    }
}
